package com.desire.test;

import java.util.LinkedList;
import java.util.Stack;

public class _13_LinkedList集合 {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();

        list.add("JAVA");

        list.add("php");
        list.add("你");
        list.add("好");
        list.add("nishi ");
        list.add("keqing");
        list.add("傀儡");

        list.remove("你");
        list.add(1, "sdf");
        list.addLast("最后");

        list.forEach(System.out::println);

        for (String s : list) {
            System.out.println(s);
        }

        System.out.println(list);


        Stack<Integer> stack = new Stack<>();
        System.out.println(stack.size());
        stack.add(1);
        stack.add(2);
        stack.add(3);
        stack.add(14);
        System.out.println(stack.size());

    }

    public static void T() {


        class Stack<E> {
            private final LinkedList<E> stack = new LinkedList<>();
            private E e;
            private int i = 0;

            public Stack() {

            }

            public int size() {
                return this.i;
            }

            public void add(E e) {
                ++i;
                stack.addLast(e);
            }

            public E get() {
                --i;
                return stack.removeLast();
            }
        }
    }
}
